package org.geektimes.projects.user.web.controller;

import org.geekbang.projects.injection.Component;
import org.geektimes.projects.user.domain.User;
import org.geektimes.web.mvc.header.annotation.BodyParam;
import org.geektimes.web.mvc.header.annotation.QueryParam;
import org.geektimes.web.mvc.header.annotation.ResponseBody;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

/**
* 用于 rest模块测试  
* @author : lsq
*/
@Path("rest")
@Component
public class RestModuleController {


	@GET
	@Path("/info")
	@ResponseBody
	public User getUser(@QueryParam("id") Long id){
		User user = new User();
		user.setId(id);
		user.setName("测试rest的用户");
		return user;
	}



	@Path("/add")
	@POST()
	@ResponseBody
	public User add(@BodyParam User user){
		user.setName("我收到响应");
		return user;
	}

}
